import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    userName: window.localStorage.getItem('userName') || '',
  }),
  actions: {
    setUsername(userName: string) {
      window.localStorage.setItem('userName', userName)
      this.userName = userName
    },
  },
})
